package com.ruoyi.management.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.management.domain.Xmfp;
import com.ruoyi.management.domain.Xmfpandmx;
import com.ruoyi.management.service.IXmfpService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 【请填写功能名称】Controller
 *
 * @author ruoyi
 * @date 2025-09-28
 */
@RestController
@RequestMapping("/system/xmfp")
public class XmfpController extends BaseController
{
    @Autowired
    private IXmfpService xmfpService;

    /**
     * 查询【请填写功能名称】列表
     */
    @PreAuthorize("@ss.hasPermi('system:xmfp:list')")
    @GetMapping("/list")
    public TableDataInfo list(Xmfp xmfp)
    {
        startPage();
        List<Xmfp> list = xmfpService.selectXmfpList(xmfp);
        return getDataTable(list);
    }

    /**
     * 导出【请填写功能名称】列表
     */
    @PreAuthorize("@ss.hasPermi('system:xmfp:export')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Xmfp xmfp)
    {
        List<Xmfp> list = xmfpService.selectXmfpList(xmfp);
        ExcelUtil<Xmfp> util = new ExcelUtil<Xmfp>(Xmfp.class);
        util.exportExcel(response, list, "【请填写功能名称】数据");
    }

    /**
     * 获取【请填写功能名称】详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:xmfp:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(xmfpService.selectXmfpById(id));
    }

    /**
     * 新增【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:xmfp:add')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Xmfp xmfp)
    {
        return toAjax(xmfpService.insertXmfp(xmfp));
    }

    /**
     * 修改【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:xmfp:edit')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Xmfp xmfp)
    {
        return toAjax(xmfpService.updateXmfp(xmfp));
    }

    /**
     * 删除【请填写功能名称】
     */
    @PreAuthorize("@ss.hasPermi('system:xmfp:remove')")
    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(xmfpService.deleteXmfpByIds(ids));
    }


    /**
     * 新增【请填写功能名称】
     */
    @PostMapping("/addXmfpAndMx")
    public AjaxResult addXmfpAndMx(@RequestBody Xmfpandmx xmfpandmx)
    {
        return xmfpService.insertXmfpandmx(xmfpandmx);
    }

    /**
     * 修改【请填写功能名称】
     */
    @PostMapping("/updateXmfpAndMx")
    public AjaxResult updateXmfpAndMx(@RequestBody Xmfpandmx xmfpandmx)
    {
        return xmfpService.updateXmfpandmx(xmfpandmx);
    }

    @PostMapping("/delXmfpAndMx/{id}")
    public AjaxResult removeXmfpAndMx(@PathVariable Long id )
    {
        return xmfpService.removeXmfpandmx(id);
    }

}
